<?php
/**
 * 디버그
 *
 */
abstract class coreDebug
{
    protected $iDebugType;
    protected $iExecTime;
    public static $aMessage = array();

    function __construct($iExecTime)
    {
        $this->iExecTime = $iExecTime;
    }

    public function show($iDebugType)
    {
        if ($_GET['debug']) $iDebugType = (int) $_GET['debug'];

        $sDebugDisplayClass = 'commDebug'.$this->getDebugType($iDebugType);
        $sDebugClass = new ${sDebugDisplayClass}($this->iExecTime);
        $sDebugClass->show();
    }

    protected function getDebugType($iDebugType)
    {
        $aDebugType = array(
            1 => 'Web',
            2 => 'Db',
            3 => 'Console',
            4 => 'Msg',
            5 => 'Firebug'
        );

        return $aDebugType[$iDebugType];
    }

    public static function setMessage($sKey, $aMessage = null)
    {
        if (!DEUG) return;

        if ($aMessage) {
            self::$aMessage[$sKey] = $aMessage;

        } else {
            self::$aMessage[] = $sKey;
        }
    }
}
